//==========================================================================
// Copyright (c) 2000-2006,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#if !defined(_CONVERT_H_)
#define _CONVERT_H_

#include <wintypes.h>
#include <eltypes.h>

#define IS_LEAP_YEAR(x)             ((x)% 400 == 0 || (!((x) & 3)          \
                                    && (x) % 100 != 0))

void __cdecl DelayLoop(UINT Count);

void ConvertFileTimeToEzTime(FILETIME filetime, SystemTime* eztime);

void ConvertSystimeToEzTime(SYSTEMTIME systime, SystemTime* eztime);

void ConvertEzTimeToSystime(SystemTime eztime, PSYSTEMTIME systime);

void ConvertSYStimeToVMtime(SystemTime ezStdtime, SystemTime *ezMVtime);

void ConvertVMtimeToDiffTime(SystemTime ezSYStime, SystemTime ezMVtime);

void ConvertTimeZoneInfoFromVM(LONG BiasIn, LONG * pBiasOut);

void ConvertTimeZoneInfoToVM(LONG BiasStd, long pBiasSet);

//DWORD ContextToWin(PDOMAININFO pDomainInfo);

typedef struct TimeConver
{
    ulong_t m_Seconds;
    int m_isPositive;
    unsigned long m_alarmSeconds;
    long Bias;
    bool isAlarm;
    HANDLE hAlarmEvent;
}TIMECONVER;

extern TIMECONVER g_TimeConver;

#endif //_CONVERT_H_
